home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Extras / IFF / IFF_Forms / 8SVX.SEQN.FADE.doc < prev    next >
Encoding:
Text File  |  1993-03-01  |  5.9 KB  |  203 lines

  1. Looping chunks for 8SVX form
  2.  
  3.                           SEQN and FADE Chunks
  4.  
  5.  
  6.        Multiple Loop Sequencing in the "8SVX" IFF 8-bit Sample Voice 
  7.             ---------------------------------------------------
  8.            Registered by Peter Norman, RamScan Software Pty Ltd.
  9.  
  10.  
  11.  
  12.  
  13. Sound samples are notorious for demanding huge amounts of memory. 
  14.  
  15. While earlier uses of digital sound on the Amiga were mainly in the form of
  16. short looping waveforms for use as musical instruments, many people today 
  17. wish to record several seconds (even minutes) of sound. This of course eats 
  18. memory.
  19.  
  20. Assuming that quite often the content of these recordings is music, and that
  21. quite often music contains several passages which repeat at given times,
  22. "verse1 .. chorus ..  verse2 .. chorus .." etc, a useful extention has been
  23. added to the 8SVX list of optional data chunks. It's purpose is to conserve
  24. memory by having the computer repeat sections rather than having several
  25. instances of a similar sound or musical passage taking up valuable sample 
  26. space.
  27.  
  28.  
  29. The "SEQN" chunk has been created to define "Multiple" loops or sections
  30. within a single octave 8SVX MONO or STEREO waveform. 
  31.  
  32. It is intended that a sampled sound player program which supports this chunk
  33. will play sections of the waveform sequentially in an order that the SEQN
  34. chunk specifies. This means for example, if an identical chorus 
  35. repeats throughout a recording, rather than have this chorus stored several
  36. times along the waveform, it is only necessary to have one copy of the chorus
  37. stored in the waveform.
  38.  
  39. A "SEQeNce" of definitions can then be set up to have the computer loop back
  40. and repeat the chorus at the required time. The remaining choruses
  41. stored in the waveform will no longer be necessary and can be removed.
  42.  
  43.  
  44. eg. If we had a recording of the following example, we would find that 
  45. there are several parts which simply repeat. Substantial savings can be made
  46. by having the computer repeat sections rather than have them stored in memory.
  47.  
  48.  
  49.  
  50. EXAMPLE
  51.  
  52. "Haaaallelujah....Haaaallelujah...Hallelujah..Hallelujah..Halleeeelujaaaah."
  53.  
  54.  
  55.  
  56. Applying a sequence to the above recording would look as follows.
  57.  
  58.  
  59. Haaaallelujah....Haaaallelujah...Hallelujah..Hallelujah..Halleeeelujaaaah.
  60. [     Loop1     ]
  61. [     Loop2     ]
  62.                                  [  Loop3   ]
  63.                                  [  Loop4   ]
  64.                                                          [     Loop5     ]
  65.  
  66.                 [   Dead Space   ]          [ Dead Space ]
  67.  
  68.  
  69. The DEAD SPACE can be removed. With careful editing of the multiple loop
  70. positions, the passage can be made to sound exactly the same as the original
  71. with far less memory required.
  72.  
  73.  
  74.  
  75. Chunk Definitions...
  76.  
  77.  
  78.  
  79. Optional Data Chunk SEQN
  80. ________________________
  81.  
  82. The optional data chunk SEQN gives the information necessary to play a
  83. sample in a sequence of defined blocks. To have a segment repeat twice,
  84. the definition occurs twice in the list.
  85.     
  86. This list consists of pairs of ULONG "loop start" and "end" definitions which
  87. are offsets from the start of the waveform. The locations or values must be
  88. LONGWORD aligned (divisable by 4).
  89.  
  90.  
  91. To determine how many loop definitions in a given file, simply divide the
  92. SEQN chunk size by 8. 
  93.  
  94. eg if chunk size == 40 ... number of loops  = (40 / 8) .. equals 5 loops.
  95.  
  96.  
  97. The raw data in a file might look like this...
  98.  
  99.  
  100.  
  101. 'S-E-Q-N' [ size ] [     Loop 1    ] [     Loop 2    ] [     Loop 3    ] 
  102.  
  103.  5345514E 00000028 00000000 00000C00 00000000 00000C00 00000C08 00002000
  104.              ^
  105.              ^     'Haaaallelujah..' 'Haaaallelujah..'   'Hallelujah..'
  106.              ^
  107.              ^
  108.              40 bytes decimal / 8 = 5 loop or segments
  109.  
  110.  
  111.  
  112.        [     Loop 4    ] [    Loop 5     ]'B-O-D-Y'   Size     Data
  113.  
  114.        00000C08 00002000 00002008 00003000 424F4459 000BE974 010101010101010
  115.  
  116.         'Hallelujah..'  'Halleeeelujah..'
  117.  
  118.  
  119.  
  120.  
  121.  
  122. In a waveform containing SEQN chunks, the oneShotHiSamples should be set to 0
  123. and the repeatHiSamples should equal the BODY length (divided by 2 if STEREO).
  124.  
  125. Remember the locations of the start and end of each segment or loop should
  126. be LONGWORD aligned.
  127.  
  128.  
  129. If the waveform is Stereo, treat the values and locations in exactly the same
  130. way. In other words, if a loop starts at location 400 within a Stereo
  131. waveform, you start the sound at the 400th byte position in the left data
  132. and the 400th byte position in the right data simultaneously.
  133.  
  134.  
  135.  
  136.     #define ID_SEQN MakeID('S','E','Q','N')
  137.     
  138.     
  139.  
  140.  
  141.  
  142. Optional Data Chunk FADE
  143. _______________________
  144.  
  145.  
  146. The FADE chunk defines at what loop number the sound should begin to 
  147. fade away to silence. It is possible to finish a sample of music in much
  148. the same way as commercial music does today. A FADE chunk consists of
  149. one ULONG value which has a number in it. This number corresponds to the 
  150. loop number at which the fade should begin.
  151.  
  152. eg. You may have a waveform containing 50 loops. A FADE definition of 45 will
  153. specify that once loop 45 is reached, fading to zero volume should begin.
  154. The rate at which this fade takes place is determined by the length of time
  155. left to play. The playing software should do a calculation based on the
  156. following...
  157.  
  158.  
  159. Length of all remaining sequences including current sequence (in bytes)
  160.  
  161. divided by 
  162.  
  163. the current playback rate in samples per second
  164.  
  165. = time remaining.
  166.  
  167.  
  168.  
  169. Begin stepping the volume down at a rate which will hit zero volume just as
  170. the waveform finishes.
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178. The raw data in a file may look like this.
  179.  
  180.  
  181.  
  182.  
  183.  'F-A-D-E'  [ Size ]   Loop No.  'B-O-D-Y'   Size   Data..
  184.  
  185.   46414445  00000004   0000002D   424F4459 000BE974 01010101 01010101 etc etc
  186.                           ^
  187.                           Start fading when loop number 45 is reached.
  188.  
  189.  
  190.  
  191.  
  192.     #define ID_FADE MakeID('F','A','D','E')
  193.  
  194.  
  195.  
  196. Although order shouldn't make much difference, it is a general rule of thumb
  197. that SEQN should come before FADE and FADE should be last before the BODY.
  198.  
  199. Stereo waveforms would have CHAN,SEQN,FADE,BODY in that order.
  200.  
  201.  
  202.  
  203.